import {onPullDownRefresh, onReachBottom} from '@dcloudio/uni-app'
import {stopPullDownRefresh} from '@/utils/uni-api-wrap/page'

export const usePageList = () => {
  const pageListRef = ref(null)

  onPullDownRefresh(async () => {
    await pageListRef.value.refresh()
    stopPullDownRefresh()
  })

  onReachBottom(async () => {
    await pageListRef.value.next()
  })

  return { pageListRef }
}
